package com.coincalf.exchange.service.impl;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.coincalf.exchange.entity.ForexOpenPositionOrder;
import com.coincalf.exchange.mapper.ForexOpenPositionOrderMapper;
import com.coincalf.exchange.service.ForexOpenPositionOrderService;
import com.coincalf.framework.enums.OpenPositionOrderStatus;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.math.BigDecimal;

/**
 * <p>
 * 开仓订单信息 服务实现类
 * </p>
 *
 * @author qiang
 * @since 2018-05-12
 */
@Service
public class ForexOpenPositionOrderServiceImpl extends ServiceImpl<ForexOpenPositionOrderMapper, ForexOpenPositionOrder> implements ForexOpenPositionOrderService {

    /**
     * 平仓修改开仓信息
     * @param openId 开仓订单号
     * @param closeVolume 平仓量
     * @param status 状态
     */
    @Override
    public void closePosition(long openId, BigDecimal returnMargin, BigDecimal closeVolume, OpenPositionOrderStatus status) {
        baseMapper.closePosition(openId, returnMargin, closeVolume, status.getCode());
    }
}
